#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>


bool MyCompare(int a, int b) {
    return a > b;
}

/**
 * 时间复杂度：O(nlogn)
 * 空间复杂度：O(1)
 * 
 * 奶牛和书架
 * @return 
 */
int main() {
    int arr[20010]{};

    int n, b;
    scanf("%d %d", &n, &b);    


    for (int i=0; i<n; i++) {
        scanf("%d", &arr[i]);
    }

    std::sort(arr, arr + n, MyCompare);    

    int cnt = 0;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += arr[i];
        cnt++;
        if (sum >= b) {
            break;
        }
    }

    printf("%d", cnt);

    return 0;
}